package q1.project.modules.system.auth.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.StringRedisTemplate;

/** sa-token Redis 配置类 */
@Configuration
public class SaTokenRedisConfig {

  private final RedisConnectionFactory redisConnectionFactory;

  public SaTokenRedisConfig(RedisConnectionFactory redisConnectionFactory) {
    this.redisConnectionFactory = redisConnectionFactory;
  }

  /** 配置 Redis 作为 sa-token 的持久化层 使用 StringRedisTemplate 简化配置 */
  @Bean
  public StringRedisTemplate stringRedisTemplate() {
    return new StringRedisTemplate(redisConnectionFactory);
  }
}
